package cn.edu.laud.sany.types;

public class ImportProcess
{
	public String name = "";
	public long count = 0;
	// 0 for not begin, 1 for importing, 2 for finish
	public int status = 0;
	public boolean isImporting = false;
	
	private ImportProcess()
	{
	}
	
	public ImportProcess(String name, int status, long count)
	{
		this.name = name;
		this.status = status;
		this.count = count;
		this.isImporting = false;
	}
	
	public static ImportProcess getImportProcess(String text)
	{
		String[] strs = text.split("\t");
		if (strs.length != 3)
		{
			return null;
		}
		String statusString = strs[1];
		String countString = strs[2];
		ImportProcess process = new ImportProcess();
		process.name = strs[0];
		if (statusString.equals("1"))
		{
			process.status = 1;
		}
		else if (statusString.equals("2"))
		{
			process.status = 2;
		}
		else
		{
			process.status = 0;
		}
		process.count = Integer.valueOf(countString);
		return process;
	}
	
}
